import { SettingsModel } from '../../models/Settings'

export default defineEventHandler(async (event) => {
  try {
    const contactInfo = await SettingsModel.getContactInfo()
    
    if (!contactInfo || Object.keys(contactInfo).length === 0) {
      return {
        success: false,
        message: '联系信息不存在',
        data: null
      }
    }

    return {
      success: true,
      message: '获取联系信息成功',
      data: contactInfo
    }
  } catch (error: any) {
    console.error('获取联系信息失败:', error)
    
    return {
      success: false,
      message: `获取联系信息失败: ${error.message}`,
      data: null
    }
  }
})